package com.ruoyi.system.service.impl.as;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.as.AsUsergreenhouseMapper;
import com.ruoyi.system.domain.as.AsUsergreenhouse;
import com.ruoyi.system.service.as.IAsUsergreenhouseService;

/**
 * 用户大棚关联Service业务层处理
 *
 * @author ruoyi
 * @date 2021-08-10
 */
@Service
public class AsUsergreenhouseServiceImpl implements IAsUsergreenhouseService
{
    @Autowired
    private AsUsergreenhouseMapper asUsergreenhouseMapper;

    /**
     * 查询用户大棚关联
     *
     * @param userId 用户大棚关联ID
     * @return 用户大棚关联
     */
    @Override
    public List<AsUsergreenhouse> selectAsUsergreenhouseById(Long userId)
    {
        return asUsergreenhouseMapper.selectAsUsergreenhouseById(userId);
    }

    /**
     * 查询用户大棚关联列表
     *
     * @param asUsergreenhouse 用户大棚关联
     * @return 用户大棚关联
     */
    @Override
    public List<AsUsergreenhouse> selectAsUsergreenhouseList(AsUsergreenhouse asUsergreenhouse)
    {
        return asUsergreenhouseMapper.selectAsUsergreenhouseList(asUsergreenhouse);
    }

    /**
     * 新增用户大棚关联
     *
     * @param asUsergreenhouse 用户大棚关联
     * @return 结果
     */
    @Override
    public int insertAsUsergreenhouse(AsUsergreenhouse asUsergreenhouse)
    {
        asUsergreenhouse.setCreateTime(DateUtils.getNowDate());
        return asUsergreenhouseMapper.insertAsUsergreenhouse(asUsergreenhouse);
    }

    /**
     * 修改用户大棚关联
     *
     * @param asUsergreenhouse 用户大棚关联
     * @return 结果
     */
    @Override
    public int updateAsUsergreenhouse(AsUsergreenhouse asUsergreenhouse)
    {

        int row=1;
        asUsergreenhouse.setUpdateTime(DateUtils.getNowDate());
        row=asUsergreenhouseMapper.insertAsUsergreenhouse(asUsergreenhouse);
        return row;

    }

    /**
     * 批量删除用户大棚关联
     *
     * @param userIds 需要删除的用户大棚关联ID
     * @return 结果
     */
    @Override
    public int deleteAsUsergreenhouseByIds(Long[] userIds)
    {
        return asUsergreenhouseMapper.deleteAsUsergreenhouseByIds(userIds);
    }

    /**
     * 删除用户大棚关联信息
     *
     * @param userId 用户大棚关联ID
     * @return 结果
     */
    @Override
    public int deleteAsUsergreenhouseById(Long userId)
    {
        return asUsergreenhouseMapper.deleteAsUsergreenhouseById(userId);
    }
}
